﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Zarion_Quest.Base;

namespace Zarion_Quest.LEVELS
{
    static class LevelManager
    {
        private static BaseLevel currentLevel;
        public static BaseLevel CurrentLevel
        {
            get
            { return currentLevel; }
        }

        /// <summary>
        /// Checks current if there is a level loaded if there
        ///  is renders it null to load next level
        /// </summary>
        /// <param name="Level"></param>
        public static void LoadLevel(BaseLevel Level)
        {
            if (currentLevel != null)
            {
                // no point?
                // currentLevel = null;
                currentLevel.UnloadContent();
            }

            currentLevel = Level;
        }

        public static void Update(GameTime gameTime)
        {
            if (currentLevel != null) currentLevel.Update(gameTime);
        }
        
        public static void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {

            if (currentLevel != null) currentLevel.Draw(gameTime, spriteBatch);
        }
    }
}
